package com.moyuaninfo.service;

import com.moyuaninfo.entity.MyyUserCron;
import com.moyuaninfo.factory.QueryFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import com.moyuaninfo.repository.MyyUserCronRepository;

import java.util.List;

/**
 * @author 邱祥霸
 * @date 2020-04-08
 */
@Component
public class MyyUserCronManger {

    @Autowired
    private MyyUserCronRepository myyUserCronRepository;

    /**
     * 获取定时参数数据
     * @return com.example.jpa.jap_demo.entity.MyyUserCron
     *
     * @author 邱祥霸
     * @date 2020/4/8
     */
    public MyyUserCron findMyyUserCronByState() {
        List<MyyUserCron> list = myyUserCronRepository.findAll(QueryFactory.equal("state", "1"));
        return CollectionUtils.isEmpty(list)? null : list.get(0);
    }
}
